Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

CascadeTemplateArray< T > Class Template Reference

an easy-to-use array class with automatic memory management More...

#include <cascade/util/CascadeArray.h>

Inheritance diagram for CascadeTemplateArray< T >:

CascadeArray CascadeObject List of all members.

Public Member Functions

 CascadeTemplateArray (u32 inDesiredItemCount=0)
virtual ~CascadeTemplateArray ()
virtual bool Append (void *inItem, u32 &outIndex)
virtual bool Insert (void *inItem, u32 &ioIndex)
virtual bool Remove (void *inItemToRemove)
virtual bool FetchItem (u32 inIndex, void *outItem) const
virtual bool Append (T &inItem, u32 &outIndex)
virtual bool Insert (T &inItem, u32 &ioIndex)
virtual bool Remove (T &inItemToRemove)
virtual bool FetchItem (u32 inIndex, T &outItem) const
virtual bool AppendArray (const CascadeTemplateArray< T > &inArray)
virtual bool InsertArray (CascadeTemplateArray< T > &inArray, u32 inIdx)

Detailed Description

template<class T>
class CascadeTemplateArray< T >

an easy-to-use array class with automatic memory management

Template-ized array of objects or types. Basically a template wrapper to CascadeArray, for more convenient syntax

CascadeTemplateArray


Constructor & Destructor Documentation

template<class T>
CascadeTemplateArray< T >::CascadeTemplateArray u32  inDesiredItemCount = 0  )  [inline]
 

constructor

Construct the array. Optional argument specifies the initial size of the array

Parameters:
inDesiredItemCount (optional) the desired initial size of the array
Note:
It is possible that the allocation for array storage will fail, but in the absence of exceptions this cannot be signalled to the caller. However, future insertion or appending to the array may fail (with appropriate return values).

template<class T>
virtual CascadeTemplateArray< T >::~CascadeTemplateArray  )  [inline, virtual]
 

destructor

destructor


Member Function Documentation

template<class T>
virtual bool CascadeTemplateArray< T >::Append T &  inItem,
u32 outIndex
[inline, virtual]
 

append an item to the array

Append the supplied item to the array. This may fail because memory may have to be allocated to hold the new item. The index of the newly-appended item is returned in the outIndex parameter if the append was successful

Note:
the contents of inItem are copied into the array
Parameters:
inItem the item to be appended
outIndex the index at which the item was appended (only if return value of function is true)
Returns:
true if successful, false if failure

template<class T>
virtual bool CascadeTemplateArray< T >::Append void *  inItem,
u32 outIndex
[inline, virtual]
 

Implementation function. do not call this function. Use the templated version instead.

Reimplemented from CascadeArray.

template<class T>
virtual bool CascadeTemplateArray< T >::AppendArray const CascadeTemplateArray< T > &  inArray  )  [inline, virtual]
 

Append a complete array to this one

Appends the complete contents of another array of type T to this array.

Note:
as with other aspects of this class, the copy is not pointer-safe or object-safe. If the supplied array contains pointers or pointers to objects, then both of the arrays will now share those pointers. Deletion in one array will affect the other. Please be sure you know what you're doing.
Parameters:
inArray the array to append
Returns:
true if successful, false if insufficient memory

template<class T>
virtual bool CascadeTemplateArray< T >::FetchItem u32  inIndex,
T &  outItem
const [inline, virtual]
 

return a copy of the item at index

Returns a copy of the item at the supplied index. May fail if the index is invalid

Parameters:
inIndex the index of the item to fetch
outItem the destination object
Returns:
true if successful, false if invalid index

template<class T>
virtual bool CascadeTemplateArray< T >::FetchItem u32  inIndex,
void *  outItem
const [inline, virtual]
 

Implementation function. do not call this function. Use the templated version instead.

Reimplemented from CascadeArray.

template<class T>
virtual bool CascadeTemplateArray< T >::Insert T &  inItem,
u32 ioIndex
[inline, virtual]
 

insert an item into the array

Insert the supplied item into the array. This may fail because memory may have to be allocated to hold the new item. The index of the newly-inserted item is returned in the ioIndex parameter if the insertion was successful

Note:
the contents of inItem are copied into the array
Parameters:
inItem the item to be inserted
ioIndex on entry, the index at which you wish to insert. If successful, on exit is the index at which the item was actually inserted (may differ if the supplied index was out of range)
Returns:
true if successful, false if failure

template<class T>
virtual bool CascadeTemplateArray< T >::Insert void *  inItem,
u32 ioIndex
[inline, virtual]
 

Implementation function. do not call this function. Use the templated version instead.

Reimplemented from CascadeArray.

template<class T>
virtual bool CascadeTemplateArray< T >::InsertArray CascadeTemplateArray< T > &  inArray,
u32  inIdx
[inline, virtual]
 

Insert a complete array into this one

Inserts the complete contents of another array of type T to this array.

Note:
as with other aspects of this class, the copy is not pointer-safe or object-safe. If the supplied array contains pointers or pointers to objects, then both of the arrays will now share those pointers. Deletion in one array will affect the other. Please be sure you know what you're doing.

an out-of-bounds index will result in an append

Parameters:
inArray the array to append
inIdx the index at which to insert the items
Returns:
true if successful, false if insufficient memory

template<class T>
virtual bool CascadeTemplateArray< T >::Remove T &  inItemToRemove  )  [inline, virtual]
 

remove an item

Removes the given item from the array. If the item cannot be found in the array, nothing happens

Parameters:
inItemToRemove the item to remove
Returns:
true if item was found and removed, false if not found

template<class T>
virtual bool CascadeTemplateArray< T >::Remove void *  inItemToRemove  )  [inline, virtual]
 

Implementation function. do not call this function. Use the templated version instead.

Reimplemented from CascadeArray.


The documentation for this class was generated from the following file:
Generated on Sun Jul 24 14:27:21 2005 for Cascade Library by  doxygen 1.4.1